package com.tankgames.superawesometankgame.views;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

public class TestView extends View {
	private static final String TAG = "TestView";
	
	private float mDegrees = 0;
	private Paint mPaint;

	public TestView(Context context) {
		super(context);

		mPaint = new Paint();
		mPaint.setColor(Color.RED);
		mPaint.setAntiAlias(true);
		mPaint.setStyle(Style.FILL);
		mPaint.setStrokeWidth(5);
		mPaint.setTextSize(50);
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		
		int width  = canvas.getWidth();
		int height = canvas.getHeight();
		
		int px = width / 3;
		int py = height / 3;
		
		canvas.save();
		canvas.rotate(mDegrees, px, py);
		canvas.drawText(
			"Tanks!!!", width / 2, height / 2, mPaint
		);
		canvas.restore();
		mDegrees = (mDegrees >= 360) ? 0 : (mDegrees += 6f);
		
		invalidate();
	}

}
